﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Hired
{
    public partial class manageAccounts : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }

        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            pnlAdminStaffAccountsDataGrid.Visible = false;
            pnlCompanyAccountsDataGrid.Visible = false;
            pnlJobseekersAccountsDataGrid.Visible = false;


            if (DropDownList1.SelectedIndex == 1)
            {
                pnlAdminStaffAccountsDataGrid.Visible = true;
            }
            if (DropDownList1.SelectedIndex == 2)
            {
                pnlJobseekersAccountsDataGrid.Visible = true;
            }
            if (DropDownList1.SelectedIndex == 3)
            {
                pnlCompanyAccountsDataGrid.Visible = true;
            }
        }

        protected void gridViewASA_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Delete")
            {
                DBAdminStaffAccount.deleteAdminStaffAccountById(e.CommandArgument.ToString());
            }
        }

        protected void gridViewJobseeker_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Delete")
            {
                DBJobseekerAccount.deleteJobseekerAccountById(e.CommandArgument.ToString());
            }

        }

        protected void gridViewCompany_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Delete")
            {
                DBCompanyAccount.DeleteCompanyAccountById(e.CommandArgument.ToString());
            }
        }

        //protected void btnDeleteASA1_Click(object sender, EventArgs e)
        //{
        //    foreach (GridViewRow gvr in gridViewASA.Rows)
        //    {
        //        if (gvr.RowType == DataControlRowType.DataRow)
        //        {
        //            CheckBox cb = (CheckBox)gvr.FindControl("CheckBox1");
        //            if (cb.Checked == true && cb != null)
        //            {
        //                DBAdminStaffAccount.deleteAdminStaffAccountById(gvr.Cells[2].Text);
        //            }
        //        }
        //    }
        //    gridViewASA.DataBind();
        //}

        //protected void btnDeleteASA2_Click(object sender, EventArgs e)
        //{
        //    foreach (GridViewRow gvr in gridViewASA.Rows)
        //    {
        //        if (gvr.RowType == DataControlRowType.DataRow)
        //        {
        //            CheckBox cb = (CheckBox)gvr.FindControl("CheckBox1");
        //            if (cb.Checked == true && cb != null)
        //            {
        //                DBAdminStaffAccount.deleteAdminStaffAccountById(gvr.Cells[2].Text);
        //            }
        //        }
        //    }
        //    gridViewASA.DataBind();
        //}

        //protected void btnDeleteCompany1_Click(object sender, EventArgs e)
        //{
        //    foreach (GridViewRow gvr in gridViewCompany.Rows) {
        //        if (gvr.RowType == DataControlRowType.DataRow)
        //        {
        //            CheckBox cb = (CheckBox)gvr.FindControl("CheckBox2");
        //            if (cb.Checked == true && cb != null)
        //            {
        //                DBCompanyAccount.DeleteCompanyAccountById(gvr.Cells[2].Text);
        //            }
        //        }
        //    }
        //    gridViewCompany.DataBind();
        //}

        //protected void btnDeleteCompany2_Click(object sender, EventArgs e)
        //{
        //    foreach (GridViewRow gvr in gridViewCompany.Rows)
        //    {
        //        if (gvr.RowType == DataControlRowType.DataRow)
        //        {
        //            CheckBox cb = (CheckBox)gvr.FindControl("CheckBox2");
        //            if (cb.Checked == true && cb != null)
        //            {
        //                DBCompanyAccount.DeleteCompanyAccountById(gvr.Cells[2].Text);
        //            }
        //        }
        //    }
        //    gridViewCompany.DataBind();
        //}

        //protected void btnDeleteJobseeker1_Click(object sender, EventArgs e)
        //{
        //    foreach (GridViewRow gvr in gridViewJobseeker.Rows)
        //    {
        //        if (gvr.RowType == DataControlRowType.DataRow)
        //        {
        //            CheckBox cb = (CheckBox)gvr.FindControl("CheckBox4");
        //            if (cb.Checked == true && cb != null)
        //            {
        //                DBJobseekerAccount.deleteJobseekerAccountById(gvr.Cells[2].Text);
        //            }
        //        }
        //    }
        //    gridViewCompany.DataBind();
        //}

        //protected void btnDeleteJobseeker2_Click(object sender, EventArgs e)
        //{
        //    foreach (GridViewRow gvr in gridViewJobseeker.Rows)
        //    {
        //        if (gvr.RowType == DataControlRowType.DataRow)
        //        {
        //            CheckBox cb = (CheckBox)gvr.FindControl("CheckBox4");
        //            if (cb.Checked == true && cb != null)
        //            {
        //                DBJobseekerAccount.deleteJobseekerAccountById(gvr.Cells[2].Text);
        //            }
        //        }
        //    }
        //    gridViewCompany.DataBind();
        //}
    }
}